﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace nadModel.pad
{
    public partial class StorageProcess : AbstractEntityProcess
    {
        public string conection_addr = "http://nad.nadfinlo.com.cn/nad/";
        public StorageEntity[] FindByParameter(MaterialRequisitionParameter p)
        {
            string sql = " select * from " + StorageEntity.DB_TABLES + " where company='" + p.company + "' "
                           + " and (" + StorageEntity.RECEIVE_NO + ">='" + p.IssueNoFrom + "' or '" + p.IssueNoFrom + "'='' ) "
                           + " and (" + StorageEntity.RECEIVE_NO + "<='" + p.IssueNoTo + "' or '" + p.IssueNoTo + "'='' )"
                           + " and (" + StorageEntity.DATE_01 + ">='" + p.CreateTimeFrom + "' or '" + p.CreateTimeFrom + "'='' )"
                           + " and (" + StorageEntity.DATE_01 + "<='" + p.CreateTimeTo + "' or '" + p.CreateTimeTo + "'='' )"
                           + " and (" + StorageEntity.JOB_NUM + ">='" + p.JobFrom + "' or '" + p.JobFrom + "'='' )"
                           + " and (" + StorageEntity.JOB_NUM + "<='" + p.JobTo + "' or '" + p.JobTo + "'='' )"
                           + " and (" + StorageEntity.PART_NUM + ">='" + p.PartFrom + "' or '" + p.PartFrom + "'='' )"
                           + " and (" + StorageEntity.PART_NUM + "<='" + p.PartTo + "' or '" + p.PartTo + "'='' )"
                           + " and (" + StorageEntity.DEPT + "='" + p.Dept + "' or '" + p.Dept + "'='' )";
            StorageEntity[] ents = (StorageEntity[])FindBySql(sql,conection_addr);
            return ents;
        }


    }
}
